<?php


/**
 * Base class that represents a query for the 'rejections' table.
 *
 *
 *
 * @method EmpevalRejectionsQuery orderByBonusGoalsFormId($order = Criteria::ASC) Order by the bonus_goals_form_id column
 * @method EmpevalRejectionsQuery orderByText($order = Criteria::ASC) Order by the text column
 * @method EmpevalRejectionsQuery orderByDecision($order = Criteria::ASC) Order by the decision column
 * @method EmpevalRejectionsQuery orderByAttachment($order = Criteria::ASC) Order by the attachment column
 * @method EmpevalRejectionsQuery orderByStatus($order = Criteria::ASC) Order by the status column
 * @method EmpevalRejectionsQuery orderByMeetingDate($order = Criteria::ASC) Order by the meeting_date column
 * @method EmpevalRejectionsQuery orderByActive($order = Criteria::ASC) Order by the active column
 * @method EmpevalRejectionsQuery orderByLastModified($order = Criteria::ASC) Order by the last_modified column
 * @method EmpevalRejectionsQuery orderByCreated($order = Criteria::ASC) Order by the created column
 *
 * @method EmpevalRejectionsQuery groupByBonusGoalsFormId() Group by the bonus_goals_form_id column
 * @method EmpevalRejectionsQuery groupByText() Group by the text column
 * @method EmpevalRejectionsQuery groupByDecision() Group by the decision column
 * @method EmpevalRejectionsQuery groupByAttachment() Group by the attachment column
 * @method EmpevalRejectionsQuery groupByStatus() Group by the status column
 * @method EmpevalRejectionsQuery groupByMeetingDate() Group by the meeting_date column
 * @method EmpevalRejectionsQuery groupByActive() Group by the active column
 * @method EmpevalRejectionsQuery groupByLastModified() Group by the last_modified column
 * @method EmpevalRejectionsQuery groupByCreated() Group by the created column
 *
 * @method EmpevalRejectionsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method EmpevalRejectionsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method EmpevalRejectionsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method EmpevalRejectionsQuery leftJoinBonusGoalsForms($relationAlias = null) Adds a LEFT JOIN clause to the query using the BonusGoalsForms relation
 * @method EmpevalRejectionsQuery rightJoinBonusGoalsForms($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BonusGoalsForms relation
 * @method EmpevalRejectionsQuery innerJoinBonusGoalsForms($relationAlias = null) Adds a INNER JOIN clause to the query using the BonusGoalsForms relation
 *
 * @method EmpevalRejectionsQuery leftJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 * @method EmpevalRejectionsQuery rightJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 * @method EmpevalRejectionsQuery innerJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a INNER JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 *
 * @method EmpevalRejectionsQuery leftJoinCommittees($relationAlias = null) Adds a LEFT JOIN clause to the query using the Committees relation
 * @method EmpevalRejectionsQuery rightJoinCommittees($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Committees relation
 * @method EmpevalRejectionsQuery innerJoinCommittees($relationAlias = null) Adds a INNER JOIN clause to the query using the Committees relation
 *
 * @method EmpevalRejections findOne(PropelPDO $con = null) Return the first EmpevalRejections matching the query
 * @method EmpevalRejections findOneOrCreate(PropelPDO $con = null) Return the first EmpevalRejections matching the query, or a new EmpevalRejections object populated from the query conditions when no match is found
 *
 * @method EmpevalRejections findOneByBonusGoalsFormId(int $bonus_goals_form_id) Return the first EmpevalRejections filtered by the bonus_goals_form_id column
 * @method EmpevalRejections findOneByText(string $text) Return the first EmpevalRejections filtered by the text column
 * @method EmpevalRejections findOneByDecision(string $decision) Return the first EmpevalRejections filtered by the decision column
 * @method EmpevalRejections findOneByAttachment(string $attachment) Return the first EmpevalRejections filtered by the attachment column
 * @method EmpevalRejections findOneByStatus(int $status) Return the first EmpevalRejections filtered by the status column
 * @method EmpevalRejections findOneByMeetingDate(string $meeting_date) Return the first EmpevalRejections filtered by the meeting_date column
 * @method EmpevalRejections findOneByActive(boolean $active) Return the first EmpevalRejections filtered by the active column
 * @method EmpevalRejections findOneByLastModified(string $last_modified) Return the first EmpevalRejections filtered by the last_modified column
 * @method EmpevalRejections findOneByCreated(string $created) Return the first EmpevalRejections filtered by the created column
 *
 * @method array findByBonusGoalsFormId(int $bonus_goals_form_id) Return EmpevalRejections objects filtered by the bonus_goals_form_id column
 * @method array findByText(string $text) Return EmpevalRejections objects filtered by the text column
 * @method array findByDecision(string $decision) Return EmpevalRejections objects filtered by the decision column
 * @method array findByAttachment(string $attachment) Return EmpevalRejections objects filtered by the attachment column
 * @method array findByStatus(int $status) Return EmpevalRejections objects filtered by the status column
 * @method array findByMeetingDate(string $meeting_date) Return EmpevalRejections objects filtered by the meeting_date column
 * @method array findByActive(boolean $active) Return EmpevalRejections objects filtered by the active column
 * @method array findByLastModified(string $last_modified) Return EmpevalRejections objects filtered by the last_modified column
 * @method array findByCreated(string $created) Return EmpevalRejections objects filtered by the created column
 *
 * @package    propel.generator.empeval.om
 */
abstract class EmpevalBaseRejectionsQuery extends ModelCriteria
{
    /**
     * Initializes internal state of EmpevalBaseRejectionsQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'vgp_empeval', $modelName = 'EmpevalRejections', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new EmpevalRejectionsQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     EmpevalRejectionsQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return EmpevalRejectionsQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof EmpevalRejectionsQuery) {
            return $criteria;
        }
        $query = new EmpevalRejectionsQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj  = $c->findPk(12, $con);
     * </code>
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   EmpevalRejections|EmpevalRejections[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = EmpevalRejectionsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is alredy in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(EmpevalRejectionsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return   EmpevalRejections A model object, or null if the key is not found
     * @throws   PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT BONUS_GOALS_FORM_ID, TEXT, DECISION, ATTACHMENT, STATUS, MEETING_DATE, ACTIVE, LAST_MODIFIED, CREATED FROM rejections WHERE BONUS_GOALS_FORM_ID = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new EmpevalRejections();
            $obj->hydrate($row);
            EmpevalRejectionsPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return EmpevalRejections|EmpevalRejections[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(12, 56, 832), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|EmpevalRejections[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the bonus_goals_form_id column
     *
     * Example usage:
     * <code>
     * $query->filterByBonusGoalsFormId(1234); // WHERE bonus_goals_form_id = 1234
     * $query->filterByBonusGoalsFormId(array(12, 34)); // WHERE bonus_goals_form_id IN (12, 34)
     * $query->filterByBonusGoalsFormId(array('min' => 12)); // WHERE bonus_goals_form_id > 12
     * </code>
     *
     * @see       filterByBonusGoalsForms()
     *
     * @see       filterByViewBgfWithSuperiorPositionId()
     *
     * @param     mixed $bonusGoalsFormId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByBonusGoalsFormId($bonusGoalsFormId = null, $comparison = null)
    {
        if (is_array($bonusGoalsFormId) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsFormId, $comparison);
    }

    /**
     * Filter the query on the text column
     *
     * Example usage:
     * <code>
     * $query->filterByText('fooValue');   // WHERE text = 'fooValue'
     * $query->filterByText('%fooValue%'); // WHERE text LIKE '%fooValue%'
     * </code>
     *
     * @param     string $text The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByText($text = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($text)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $text)) {
                $text = str_replace('*', '%', $text);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::TEXT, $text, $comparison);
    }

    /**
     * Filter the query on the decision column
     *
     * Example usage:
     * <code>
     * $query->filterByDecision('fooValue');   // WHERE decision = 'fooValue'
     * $query->filterByDecision('%fooValue%'); // WHERE decision LIKE '%fooValue%'
     * </code>
     *
     * @param     string $decision The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByDecision($decision = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($decision)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $decision)) {
                $decision = str_replace('*', '%', $decision);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::DECISION, $decision, $comparison);
    }

    /**
     * Filter the query on the attachment column
     *
     * Example usage:
     * <code>
     * $query->filterByAttachment('fooValue');   // WHERE attachment = 'fooValue'
     * $query->filterByAttachment('%fooValue%'); // WHERE attachment LIKE '%fooValue%'
     * </code>
     *
     * @param     string $attachment The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByAttachment($attachment = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($attachment)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $attachment)) {
                $attachment = str_replace('*', '%', $attachment);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::ATTACHMENT, $attachment, $comparison);
    }

    /**
     * Filter the query on the status column
     *
     * Example usage:
     * <code>
     * $query->filterByStatus(1234); // WHERE status = 1234
     * $query->filterByStatus(array(12, 34)); // WHERE status IN (12, 34)
     * $query->filterByStatus(array('min' => 12)); // WHERE status > 12
     * </code>
     *
     * @param     mixed $status The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByStatus($status = null, $comparison = null)
    {
        if (is_array($status)) {
            $useMinMax = false;
            if (isset($status['min'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::STATUS, $status['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($status['max'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::STATUS, $status['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::STATUS, $status, $comparison);
    }

    /**
     * Filter the query on the meeting_date column
     *
     * Example usage:
     * <code>
     * $query->filterByMeetingDate('2011-03-14'); // WHERE meeting_date = '2011-03-14'
     * $query->filterByMeetingDate('now'); // WHERE meeting_date = '2011-03-14'
     * $query->filterByMeetingDate(array('max' => 'yesterday')); // WHERE meeting_date > '2011-03-13'
     * </code>
     *
     * @param     mixed $meetingDate The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByMeetingDate($meetingDate = null, $comparison = null)
    {
        if (is_array($meetingDate)) {
            $useMinMax = false;
            if (isset($meetingDate['min'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::MEETING_DATE, $meetingDate['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($meetingDate['max'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::MEETING_DATE, $meetingDate['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::MEETING_DATE, $meetingDate, $comparison);
    }

    /**
     * Filter the query on the active column
     *
     * Example usage:
     * <code>
     * $query->filterByActive(true); // WHERE active = true
     * $query->filterByActive('yes'); // WHERE active = true
     * </code>
     *
     * @param     boolean|string $active The value to use as filter.
     *              Non-boolean arguments are converted using the following rules:
     *                * 1, '1', 'true',  'on',  and 'yes' are converted to boolean true
     *                * 0, '0', 'false', 'off', and 'no'  are converted to boolean false
     *              Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByActive($active = null, $comparison = null)
    {
        if (is_string($active)) {
            $active = in_array(strtolower($active), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::ACTIVE, $active, $comparison);
    }

    /**
     * Filter the query on the last_modified column
     *
     * Example usage:
     * <code>
     * $query->filterByLastModified('2011-03-14'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified('now'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified(array('max' => 'yesterday')); // WHERE last_modified > '2011-03-13'
     * </code>
     *
     * @param     mixed $lastModified The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByLastModified($lastModified = null, $comparison = null)
    {
        if (is_array($lastModified)) {
            $useMinMax = false;
            if (isset($lastModified['min'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::LAST_MODIFIED, $lastModified['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($lastModified['max'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::LAST_MODIFIED, $lastModified['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::LAST_MODIFIED, $lastModified, $comparison);
    }

    /**
     * Filter the query on the created column
     *
     * Example usage:
     * <code>
     * $query->filterByCreated('2011-03-14'); // WHERE created = '2011-03-14'
     * $query->filterByCreated('now'); // WHERE created = '2011-03-14'
     * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13'
     * </code>
     *
     * @param     mixed $created The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function filterByCreated($created = null, $comparison = null)
    {
        if (is_array($created)) {
            $useMinMax = false;
            if (isset($created['min'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($created['max'])) {
                $this->addUsingAlias(EmpevalRejectionsPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalRejectionsPeer::CREATED, $created, $comparison);
    }

    /**
     * Filter the query by a related EmpevalBonusGoalsForms object
     *
     * @param   EmpevalBonusGoalsForms|PropelObjectCollection $bonusGoalsForms The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalRejectionsQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByBonusGoalsForms($bonusGoalsForms, $comparison = null)
    {
        if ($bonusGoalsForms instanceof EmpevalBonusGoalsForms) {
            return $this
                ->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsForms->getId(), $comparison);
        } elseif ($bonusGoalsForms instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsForms->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByBonusGoalsForms() only accepts arguments of type EmpevalBonusGoalsForms or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the BonusGoalsForms relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function joinBonusGoalsForms($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('BonusGoalsForms');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'BonusGoalsForms');
        }

        return $this;
    }

    /**
     * Use the BonusGoalsForms relation BonusGoalsForms object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalBonusGoalsFormsQuery A secondary query class using the current class as primary query
     */
    public function useBonusGoalsFormsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinBonusGoalsForms($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'BonusGoalsForms', 'EmpevalBonusGoalsFormsQuery');
    }

    /**
     * Filter the query by a related EmpevalViewBgfWithSuperiorPositionId object
     *
     * @param   EmpevalViewBgfWithSuperiorPositionId|PropelObjectCollection $viewBgfWithSuperiorPositionId The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalRejectionsQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByViewBgfWithSuperiorPositionId($viewBgfWithSuperiorPositionId, $comparison = null)
    {
        if ($viewBgfWithSuperiorPositionId instanceof EmpevalViewBgfWithSuperiorPositionId) {
            return $this
                ->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $viewBgfWithSuperiorPositionId->getId(), $comparison);
        } elseif ($viewBgfWithSuperiorPositionId instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $viewBgfWithSuperiorPositionId->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByViewBgfWithSuperiorPositionId() only accepts arguments of type EmpevalViewBgfWithSuperiorPositionId or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function joinViewBgfWithSuperiorPositionId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('ViewBgfWithSuperiorPositionId');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'ViewBgfWithSuperiorPositionId');
        }

        return $this;
    }

    /**
     * Use the ViewBgfWithSuperiorPositionId relation ViewBgfWithSuperiorPositionId object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalViewBgfWithSuperiorPositionIdQuery A secondary query class using the current class as primary query
     */
    public function useViewBgfWithSuperiorPositionIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinViewBgfWithSuperiorPositionId($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'ViewBgfWithSuperiorPositionId', 'EmpevalViewBgfWithSuperiorPositionIdQuery');
    }

    /**
     * Filter the query by a related EmpevalCommittees object
     *
     * @param   EmpevalCommittees|PropelObjectCollection $committees  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalRejectionsQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByCommittees($committees, $comparison = null)
    {
        if ($committees instanceof EmpevalCommittees) {
            return $this
                ->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $committees->getBonusGoalsFormId(), $comparison);
        } elseif ($committees instanceof PropelObjectCollection) {
            return $this
                ->useCommitteesQuery()
                ->filterByPrimaryKeys($committees->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByCommittees() only accepts arguments of type EmpevalCommittees or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the Committees relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function joinCommittees($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('Committees');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'Committees');
        }

        return $this;
    }

    /**
     * Use the Committees relation Committees object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalCommitteesQuery A secondary query class using the current class as primary query
     */
    public function useCommitteesQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinCommittees($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'Committees', 'EmpevalCommitteesQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   EmpevalRejections $rejections Object to remove from the list of results
     *
     * @return EmpevalRejectionsQuery The current query, for fluid interface
     */
    public function prune($rejections = null)
    {
        if ($rejections) {
            $this->addUsingAlias(EmpevalRejectionsPeer::BONUS_GOALS_FORM_ID, $rejections->getBonusGoalsFormId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}
